﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns:skdData="clr-namespace:SkyDriveConnector"
    xmlns:System="clr-namespace:System;assembly=mscorlib" x:Class="SkyDriveConnector.MainPage"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <UserControl.Resources>
        <skdData:HyperLinkConverter x:Key="hyperlinkConverter"   />
        <sdk:HierarchicalDataTemplate x:Key="treeTemplate" >
            <StackPanel Orientation="Horizontal" >

                <Image Source="{Binding icon}" 
                           Margin="0,0,5,0"
                           Width="16" Height="16"/>
                <TextBlock x:Name="TreeNodeText" Text="{Binding name}" 
                               skdData:CustomProperties.ItemPath="{Binding upload_location}"
                               skdData:CustomProperties.ItemId="{Binding id}"/>

            </StackPanel>
        </sdk:HierarchicalDataTemplate>

        <DataTemplate x:Key="PropertiesTemplate">
            <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <StackPanel Orientation="Horizontal">
                    <TextBlock HorizontalAlignment="Left" Foreground="Black" Text="{Binding FieldDisplayName}" Width="200" TextWrapping="Wrap"/>

                    <TextBlock HorizontalAlignment="Right" Margin="0,0,1,0" Foreground="Black" Text="{Binding Value}" 
                               MaxWidth="400" TextWrapping="Wrap" Visibility="Collapsed" />

                    <ContentControl Content="{Binding Value, Converter={StaticResource hyperlinkConverter}}"
                                    HorizontalContentAlignment="Stretch" 
                                    VerticalContentAlignment="Stretch" />

                </StackPanel>
            </Border>
        </DataTemplate>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White" Loaded="LayoutRoot_Loaded">
        <Grid.RowDefinitions>
            <RowDefinition Height="500"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            
        </Grid.ColumnDefinitions>
    	<ListBox Visibility="Collapsed" x:Name="PropertiesList" ItemTemplate="{StaticResource PropertiesTemplate}" Grid.Column="1">
    		<ListBox.Background>
    			<LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
    				<GradientStop Color="#FFD5D4CE"/>
    				<GradientStop Color="White" Offset="1"/>
    			</LinearGradientBrush>
    		</ListBox.Background>
    	</ListBox>
        <sdk:DataGrid x:Name="gridResponseMessages" Margin="0" Visibility="Collapsed"
                      Grid.Row="1" Grid.Column="0"  Grid.ColumnSpan="1" AlternatingRowBackground="{x:Null}" RowBackground="{x:Null}" Background="{x:Null}"/>
        <sdk:GridSplitter Margin="0" Grid.Row="1" Height="5" Background="#FF1514DB" HorizontalAlignment="Stretch" VerticalAlignment="Top" Grid.ColumnSpan="2" Canvas.ZIndex="1" Opacity="0"/>
    	<sdk:GridSplitter HorizontalAlignment="Left" Width="5" 
                           LayoutUpdated="GridSplitter_LayoutUpdated"
                          Canvas.ZIndex="1" Background="#FFEB4646" Grid.Column="1" Opacity="0"/>

    	<Grid Canvas.ZIndex="99">
            
    		<Canvas>
    			<sdk:TreeView x:Name="skydriveTreeView" SelectedItemChanged="skyDriveTreeview_SelectedItemChanged" 
    				BorderThickness="0" Padding="0" ScrollViewer.HorizontalScrollBarVisibility="Auto" 
    				ScrollViewer.VerticalScrollBarVisibility="Auto" Margin="0" Height="500" Width="400" FontFamily="Calibri" FontSize="14.667">
    				<sdk:TreeViewItem x:Name="TreeViewItems" Header="SkyDrive Root" 
    					ItemTemplate="{StaticResource treeTemplate}" 
    					MouseRightButtonDown="TreeViewItems_MouseRightButtonDown"
    					MouseRightButtonUp="TreeViewItems_MouseRightButtonUp"
    					IsExpanded="True"/>
    			</sdk:TreeView>
    			<ListBox x:Name="DropDownMenu"  Width="{Binding Width, ElementName=Separator}"  Visibility="Collapsed" FontFamily="Calibri" FontSize="13.333">
    				<ListBox.Background>
    					<RadialGradientBrush>
    						<GradientStop Color="#FFF6F1F1" Offset="0"/>
    						<GradientStop Color="Silver" Offset="1"/>
    					</RadialGradientBrush>
    				</ListBox.Background>
                    <ListBoxItem MouseLeftButtonUp="btnRefresh_Click">                       
                        <StackPanel Orientation="Horizontal">
                            <Image Margin="0,0,5,0" Height="16" Width="16" Source="images/refresh.png" HorizontalAlignment="Left"/>
                            <TextBlock   x:Name="btnRefresh" Text="Refresh"   HorizontalAlignment="Left"   />                    		
                    	</StackPanel>
                    </ListBoxItem>
                    <ListBoxItem MouseLeftButtonUp="btnNewFolder_Click" >
                        <StackPanel Orientation="Horizontal">
                            <Image Margin="0,0,5,0" Height="16" Width="16" Source="images/newfolder.png" HorizontalAlignment="Left"/>
                            <TextBlock   x:Name="btnNewFolder" Text="New Folder"   />
                        </StackPanel>
                        
    				</ListBoxItem>
                    <ListBoxItem MouseLeftButtonUp="btnNewItem_Click">
                        <StackPanel Orientation="Horizontal">
                            <Image Margin="0,0,5,0" Height="16" Width="16" Source="images/newfile.png" HorizontalAlignment="Left"/>
                            <TextBlock  x:Name="btnNewItem" Text="New File" />
                        </StackPanel>
                        
    				</ListBoxItem>
                    <ListBoxItem MouseLeftButtonUp="btnImportItem_Click">
                        <StackPanel Orientation="Horizontal">
                            <Image Margin="0,0,5,0" Height="16" Width="16" Source="images/import.png" HorizontalAlignment="Left"/>
                            <TextBlock x:Name="btnImportItem" Text="Import Item"  />
                        </StackPanel>

                        
    				</ListBoxItem>
    				<ListBoxItem IsEnabled="False" >
    					<TextBlock x:Name="Separator" Text="" />
    				</ListBoxItem>
                    <ListBoxItem MouseLeftButtonUp="btnDeleteItem_Click" >
                        <StackPanel Orientation="Horizontal">
                            <Image Margin="0,0,5,0" Height="16" Width="16" Source="images/Delete.png" HorizontalAlignment="Left"/>
                            <TextBlock x:Name="btnDeleteItem" Text="Delete Item"   />
                        </StackPanel>
                        
    				</ListBoxItem>
                    <ListBoxItem MouseLeftButtonUp="btnSyncItems_Click">
                        <StackPanel Orientation="Horizontal">
                            <Image Margin="0,0,5,0" Height="16" Width="16" Source="images/sync.png" HorizontalAlignment="Left"/>
                            <TextBlock   x:Name="btnSyncItems" Text="Sync"    />
                        </StackPanel>
                       
    				</ListBoxItem>
    				<ListBoxItem IsEnabled="False" >
                        <TextBlock x:Name="Separator1" Text="" />
    				</ListBoxItem>
                    <ListBoxItem MouseLeftButtonUp="btnSortNameAsc_Click">
                        <StackPanel Orientation="Horizontal">
                            <Image Margin="0,0,5,0" Height="16" Width="16" Source="images/namesort_desc.png" HorizontalAlignment="Left"/>
                            <TextBlock  Text="Sort Name Ascending" />
                        </StackPanel>
                       
    				</ListBoxItem>
                    <ListBoxItem MouseLeftButtonUp="btnSortNameDesc_Click">
                        <StackPanel Orientation="Horizontal">
                            <Image Margin="0,0,5,0" Height="16" Width="16" Source="images/name_asc.png" HorizontalAlignment="Left"/>
                            <TextBlock  Text="Sort Name Descending" />
                        </StackPanel>

                        
                    </ListBoxItem>
                    <ListBoxItem MouseLeftButtonUp="btnSortDateAsc_Click">
                        <StackPanel Orientation="Horizontal">
                            <Image Margin="0,0,5,0" Height="16" Width="16" Source="images/datesort_asc.png" HorizontalAlignment="Left"/>
                            <TextBlock  Text="Sort Modified Date Ascending" />
                        </StackPanel>
                       
                    </ListBoxItem>
                    <ListBoxItem MouseLeftButtonUp="btnSortDateDesc_Click">
                        <StackPanel Orientation="Horizontal">
                            <Image Margin="0,0,5,0" Height="16" Width="16" Source="images/datesort_desc.png" HorizontalAlignment="Left"/>
                            <TextBlock  Text="Sort Modified Date Descending" />
                        </StackPanel>
                       
                    </ListBoxItem>
                    <ListBoxItem IsEnabled="False" >
                        <TextBlock  Text="" />
                    </ListBoxItem>
                    <ListBoxItem  MouseLeftButtonUp="btnDebugInfo_Click">
                        <StackPanel Orientation="Horizontal">
                            <Image Margin="0,0,5,0" Height="16" Width="16" Source="images/debug.png" HorizontalAlignment="Left"/>
                            <TextBlock  x:Name="btnDebugInfo" Text="Debug Info"/>
                        </StackPanel>
                       
    				</ListBoxItem>
    			</ListBox>
    		</Canvas>
    	</Grid>

    </Grid>
</UserControl>
